package com.exercise.widgets.recyclerview.selection.selector

import android.app.Person
import androidx.recyclerview.selection.ItemKeyProvider
import com.exercise.widgets.recyclerview.selection.adapter.ContactAdapter
import com.exercise.widgets.recyclerview.selection.entity.Contact

class ContactKeyProvider(
    private val adapter: ContactAdapter
) : ItemKeyProvider<Contact>(SCOPE_CACHED) {
    override fun getKey(position: Int): Contact {
        return adapter.getItem(position)
    }

    override fun getPosition(key: Contact): Int {
        return adapter.indexOf(key)
    }
}